-
Notifications
You must be signed in to change notification settings - Fork 523
Regex parsing fixes for newline characters and marker verbs #3268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
You've opened the pull request against the latest branch 1.12.x. If your code is relevant on 1.11.x and you want it to be released sooner, please rebase your pull request and change its target to 1.11.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - thanks
assertType('array{string, non-empty-string, non-empty-string, non-empty-string}', $matches); | ||
} | ||
if (preg_match('/foo(*:first)|bar(*:second)([x])/', $s, $matches)) { | ||
assertType("array{0: string, 1?: non-empty-string, MARK?: 'first'|'second'}", $matches); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should MARK be non-optional since we are sure here about the successfull match?
(in other words: should it be optional/non-optional depending on $wasMatched
(or other alternation rules)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it as such because it depends where the mark is https://3v4l.org/vJofm - and it seems to me not really worth the effort to ensure whether it's in a match group that is optional or not, given how niche this feature is.
Thank you! |
cc @staabm @mvorisek